Socket
Socket
Sign inDemoInstall

require-relative

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

require-relative

require and resolve modules relative to a path of your choice


Version published
Weekly downloads
1.1M
increased by6.82%
Maintainers
1
Weekly downloads
 
Created

What is require-relative?

The require-relative npm package allows you to require modules relative to a given path, rather than relative to the current module. This can be particularly useful in large projects where you need to manage dependencies in a more flexible way.

What are require-relative's main functionalities?

Require a module relative to a given path

This feature allows you to require a module relative to a specified base path. In the code sample, `./myModule` is required relative to `/path/to/base`.

const requireRelative = require('require-relative');
const myModule = requireRelative('./myModule', '/path/to/base');

Resolve a module path relative to a given path

This feature allows you to resolve the path of a module relative to a specified base path without actually requiring it. In the code sample, the path to `./myModule` is resolved relative to `/path/to/base`.

const requireRelative = require('require-relative');
const modulePath = requireRelative.resolve('./myModule', '/path/to/base');

Other packages similar to require-relative

Keywords

FAQs

Package last updated on 20 Dec 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc